package com.meshnetics.gb.util.formatters;

import com.meshnetics.gb.util.Conversions;

/**
 * Common used Byte Buffer formatters
 *
 * @author Yury Aserchev (yaserchev@meshnetics.com)
 *         Date: 30.08.2007 11:28:53
 */
public final class BufferFormatters {
    /**
     * Format buffer as sequence of hex one byte numbers, separated by symbol '-' with common
     * hex prefix at the start of string (example: "0xA0-F3-94-BA").
     */
    public static final BufferFormatter HEX_NUMBER = new UniversalByteBufferFormat(false, "-",
            Conversions.HEX_PREFIX, ByteFormatters.HEX, false);
    /**
     * Format buffer as standard, but hex array. Bytes separated by symbol ',' with common
     * hex prefix at the start of string, common square brackets and length of array before
     * brackets (example: "length: 5 [0xA0, F3, 94, BA, 00]").
     */
    public static final BufferFormatter HEX_ARRAY = new UniversalByteBufferFormat(true, ", ",
            Conversions.HEX_PREFIX, ByteFormatters.HEX, true);
    /**
     * Format buffer as standard, but complex (hex and decimal) array. Bytes separated by symbol
     * ',' with individual hex prefix at each byte, common square brackets and length of array before
     * brackets (example: "length: 3 [10 (0x0A), 17 (0x12), 255 (0xFF)]").
     */
    public static final BufferFormatter DEFAULT_ARRAY = new UniversalByteBufferFormat();
    /**
     * Format buffer as array of unsigned decimal bytes with length before bytes. Example: "length:
     * 4 [10, 255, 0, 190]"
     */
    public static final BufferFormatter DEC_UBYTE_ARRAY = new UniversalByteBufferFormat(true, ", ",
            null, ByteFormatters.DEC_UBYTE, true);
    /**
     * Format buffer as array of decimal bytes with length before bytes. Example: "length:
     * 4 [10, -1, 120, -118]"
     */
    public static final BufferFormatter DEC_BYTE_ARRAY = new UniversalByteBufferFormat(true, ", ",
            null, ByteFormatters.DEC_BYTE, true);

    private BufferFormatters(){}
}
